using System;
using System.Drawing;

namespace WebChart
{
	public class SquareLineMarker : LineMarker
	{
		// Fields
		private Brush brush;
		private Pen pen;

		// Methods
		public SquareLineMarker()
		{
			this.brush = null;
			this.pen = null;
		}

		public SquareLineMarker(int size, Color color, Color borderColor) : base(size, color, borderColor)
		{
			this.brush = null;
			this.pen = null;
		}

		public override void Render(Graphics graphics, int x, int y)
		{
			int width = base.Size;
			graphics.FillRectangle(this.Brush, x - (width / 2), y - (width / 2), width, width);
			graphics.DrawRectangle(this.Pen, x - (width / 2), y - (width / 2), width, width);
		}

		// Properties
		private Brush Brush
		{
			get
			{
				if (this.brush == null)
				{
					this.brush = new SolidBrush(base.Color);
				}
				return this.brush;
			}
		}

		private Pen Pen
		{
			get
			{
				if (this.pen == null)
				{
					this.pen = new Pen(base.BorderColor, 0f);
				}
				return this.pen;
			}
		}
	}
}
